#!/usr/bin/env python

import xml.dom.minidom

from DataColumn import *

class DataSchema(dict):
    def _get_name(self):
        return self .__name
    def _set_name(self, name):
        self.__name = name
        
    def _get_dataset(self):
        return self.__dataSet
    def _set_dataset(self, dataSet):
        self.__dataSet = dataSet

    name = property(_get_name, _set_name)
    dataset = property(_get_dataset, _set_dataset)


    def __init__(self, name):
        self.dataset = None
        self.name = name
        
    def load_file(self, filePath):
        pass
    
    def load_xml(self, xmlDom):
        if (not xmlDom.tagName == "DataSchema"):
            raise Exception()
        
        for columnNode in xmlDom.getElementsByTagName("DataColumn"):
            column = DataColumn(columnNode.getAttribute("name"))
            self[column.name] = column
            column.load_xml(columnNode)
        
        pass
    
    def save_file(self, filePath):
        pass
    
    def save_xml(self):
        pass